package com.totem.customer.controller;

import cn.hutool.core.lang.Assert;
import com.totem.base.model.PageVO;
import com.totem.base.model.Result;
import com.totem.base.mybatis.controller.BaseController;
import com.totem.customer.api.ITFavoriteServiceApi;
import com.totem.customer.model.TFavorites;
import com.totem.customer.serivce.ITFavoriteService;
import com.totem.customer.vo.FavoritePageVO;
import com.totem.customer.vo.UpdateFavoriteVO;
import com.totem.product.vo.ProductVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class FavoriteController extends BaseController<ITFavoriteService, TFavorites> implements ITFavoriteServiceApi {
    @Override
    public Result<Boolean> update(UpdateFavoriteVO vo) {
        Assert.notNull(vo.getProductId(), "产品Id必填");
        return Result.result("修改收藏信息成功", "修改收藏信息失败", service.updateFavorite(vo));
    }

    @Override
    public Result<PageVO<ProductVO>> favoritePage(FavoritePageVO vo) {
        return Result.success(service.favoritePage(vo));
    }
}
